package com.java.common.base.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;
/**
 * Title:AbstractModel<br>
 * Description:包含创建人、创建时间、更新人、更新时间、版本号的业务对象基类<br>
 * Company: IBM<br>
 * Copyright @ 2012 .All rights reserved. <br>
 * @author Liuhl<br>
 * @version 2012-3-19 1.0
 */
@MappedSuperclass
public abstract class AbstractModel implements java.io.Serializable {
	/**
	 * <code>serialVersionUID</code> 的注释
	 */
	private static final long serialVersionUID = -2744963888621005088L;
	
	public static Byte DELETED = 1;
	
	public static Byte UN_DELETED = 0;

	/**
	 * 创建日期
	 */
	private Date createTime;
	
	/**
	 * 更新日期
	 */	
	private Date modifyTime;
	
	/**
	 * 创建人
	 */
	private String createUserId;
	
	/**
	 * 更新人
	 */
	private String modifyUserId;
	
	/**
	 * 是否删除
	 */	
	private Byte isDeleted;
	/**
	 * 版本控制（乐观锁）
	 */
	private Integer version;	
	

    
    @Column(name="CREATE_USER_ID", length=64, updatable=false)

    public String getCreateUserId() {
        return this.createUserId;
    }
    
    public void setCreateUserId(String createUserId) {
        this.createUserId = createUserId;
    }
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name="CREATE_TIME", length=7, updatable=false)

    public Date getCreateTime() {
        return this.createTime;
    }
    
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    
    @Column(name="MODIFY_USER_ID", length=64)

    public String getModifyUserId() {
        return this.modifyUserId;
    }
    
    public void setModifyUserId(String modifyUserId) {
        this.modifyUserId = modifyUserId;
    }
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name="MODIFY_TIME", length=7)

    public Date getModifyTime() {
        return this.modifyTime;
    }
    
    public void setModifyTime(Date modifyTime) {
        this.modifyTime = modifyTime;
    }
    
	@Column(name="IS_DELETED", precision=2, scale=0)
    public Byte getIsDeleted() {
        return this.isDeleted;
    }
    
    public void setIsDeleted(Byte isDeleted) {
        this.isDeleted = isDeleted;
    }

	//@Version
	//@Column(name="VERSION")
    @Transient
	public Integer getVersion() {
		return version;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}
}
